package com.xsh.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoader;

public class GetClassUtils<T> {

    public static ApplicationContext context;

    public static ApplicationContext getContext(){
        context = ContextLoader.getCurrentWebApplicationContext();
        return context;
    }

    public static Object getClass(String className){
        context = ContextLoader.getCurrentWebApplicationContext();
        return context.getBean(className);
    }

    public static <T> T getExactClass(String className, Class<T> t) {
        context = ContextLoader.getCurrentWebApplicationContext();
        return context.getBean(className, t);
    }
}
